// Copyright 2017, Paul DeMarco.
// All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'dart:io';
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:robotcontrol/app_init.dart';
import 'package:robotcontrol/http/http_manager.dart';
import 'package:robotcontrol/page/get_material_app_widget.dart';
import 'package:robotcontrol/page/home_tabmavigation.dart';
void main(){
  runApp(MainAPP());
  //判断是否为安卓平台
  if(Platform.isAndroid){
    //进行沉浸式
    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(statusBarColor: Colors.transparent));
  }
}
class MainAPP extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    //异步更新ui
    return FutureBuilder(
        future:AppInit.init(),
        builder:(BuildContext context, AsyncSnapshot<void> snapshot){
          // HttpManager.getData( "http://baobab.kaiyanapp.com/api/v2/feed?num=1",
          // success: (result){
          //   print(result["issueList"][0]);
          // }
          // );
          var widget = snapshot.connectionState == ConnectionState.done
          ?HomeTabNavigation()
              :Scaffold(
            body: Center(
              //进度圈
              child: CircularProgressIndicator(),
            ),
          );
          return GetMaterialAppWidget(widget: widget);
        },);
  }

}